<template>
  <div style="margin-left: 70px">
    <el-tooltip class="item" effect="dark" content="刷新" placement="top">
      <el-button circle icon="Refresh" @click="update" />
    </el-tooltip>
  </div>
  <el-table
    :data="WaitAssessorList"
    style="
      width: 90%;
      border-radius: 8px;
      margin: 20px auto;
      box-shadow: 5px 5px 10px rgba(64, 158, 255, 0.5);
    "
    size="large"
    :header-cell-style="{
      background: '#337ecc !important',
      color: '#ffffff',
      border: 'none !important',
      textAlign: 'center',
    }"
  >
    <!--<el-table-column type="selection" width="55" />-->
    <el-table-column prop="empName" label="员工姓名" width="150">
    </el-table-column>
    <el-table-column prop="position" label="岗位" width="180"></el-table-column>
    <el-table-column prop="deptName" label="所属单元" width="180" />
    <el-table-column label="操作">
      <template #default="scope">
        <el-button type="success" @click="onShowClick(scope.$index, scope.row)"
          >开始评分</el-button
        >
        <!--<el-button
          @click="handleDelete(scope.$index, scope.row)"
          >指定专人申报</el-button
        >-->
      </template>
    </el-table-column>
  </el-table>
</template>
<script setup>
import { ref, onMounted, onBeforeMount, reactive, watch } from "vue";
import { Timer } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";
import { getFourthEnterTask } from "@/api/task";
import { ElMessage } from "element-plus";

const router = useRouter();

const handleEdit = (index, row) => {};
const handleDelete = (index, row) => {};

const WaitAssessorList = ref([]);
let assessorId = JSON.parse(localStorage.getItem("userInfo")).id;
onBeforeMount(() => {
  getFourthEnterTask({ assessorId }).then((data) => {
    WaitAssessorList.value = data.data;
  });
});

const finish = 0;
const onShowClick = (index, row) => {
  router.push({
    path: "/declare/DeclareDetial",
    query: row,
    finish,
  });
};

const update = () => {
  let assessorId = JSON.parse(localStorage.getItem("userInfo")).id;
  getFourthEnterTask({ assessorId }).then((data) => {
    if (data.code == 200) {
      ElMessage({
        message: "更新成功",
        type: "success",
      });
      WaitAssessorList.value = data.data;
    } else {
      ElMessage.error("更新成功");
    }
  });
};
</script>

<style lang="scss" scoped>
.step {
  width: 1000px;
  margin: 20px auto;
}
</style>
